function lstinf$(a$,b$,c$)
  adra=1:adrb=1:blngt=len(b$):d$=""
  while adrb<=blngt
    if mid$ (a$,adra,1)=mid$ (b$,adrb,1) then:adrb+=1:end if
    adra=adra+1
    end while
  while mid$(a$,adra,1)<>left$(c$,1)
    d$=d$+mid$(a$,adra,1):adra=adra+1
    end while
  lstinf$=d$
  end function

function vldc(a$)
  t0$="!"+a$+".0.0.0."
  t1$=lstinf$(t0$,"!",".")
  t2$=lstinf$(t0$,".",".")
  t3=10^(len(t2$))
  vldc=val(t1$)+(val(t2$)/t3)
  end function

dim chfq[16],chvl[16]

finp$="_.csv"
if argc>2 then:finp$=argv(2):end if

print"56676D20 FFFFFF00 6101000000000000000000004F0A000030130800A700"
print"0000000000003C0000000000000000000000000000008C00000000000000"
print"000000000000000000000000000000000000000000000000000000000000"
print"000000000000000000000000000000000000000000000000000000000000"
print"000000000000000000000000000000000000000000000000000000000000"
print"0000000000000000000000000000 999E3640 00000000 00000000 00000000"
print"000000000000000000000000"

print"B901FF "
print"B90000"
print"B90400 B905FF"
print"B90600 B90601 B90602 B90603"
print"B90604 B90605 B90606 B90607"
print"B90608 B90609 B9060A B9060B"
print"B9060C B9060D B9060E B9060F"
print"B90610 B90611 B90612 B90613"
print"B90614 B90615 B90616 B90617"
print"B90618 B90619 B9061A B9061B"
print"B9061C B9061D B9061E B9061F"
print"B90800 B90900 "
print"B90001"
print"B90400 B905FF"
print"B90600 B90601 B90602 B90603"
print"B90604 B90605 B90606 B90607"
print"B90608 B90609 B9060A B9060B"
print"B9060C B9060D B9060E B9060F"
print"B90610 B90611 B90612 B90613"
print"B90614 B90615 B90616 B90617"
print"B90618 B90619 B9061A B9061B"
print"B9061C B9061D B9061E B9061F"
print"B90002"
print"B90400 B905FF"
print"B90600 B90601 B90602 B90603"
print"B90604 B90605 B90606 B90607"
print"B90608 B90609 B9060A B9060B"
print"B9060C B9060D B9060E B9060F"
print"B90610 B90611 B90612 B90613"
print"B90614 B90615 B90616 B90617"
print"B90618 B90619 B9061A B9061B"
print"B9061C B9061D B9061E B9061F"
print"B90003"
print"B90400 B905FF"
print"B90600 B90601 B90602 B90603"
print"B90604 B90605 B90606 B90607"
print"B90608 B90609 B9060A B9060B"
print"B9060C B9060D B9060E B9060F"
print"B90610 B90611 B90612 B90613"
print"B90614 B90615 B90616 B90617"
print"B90618 B90619 B9061A B9061B"
print"B9061C B9061D B9061E B9061F"
print"B90004"
print"B90400 B905FF"
print"B90600 B90601 B90602 B90603"
print"B90604 B90605 B90606 B90607"
print"B90608 B90609 B9060A B9060B"
print"B9060C B9060D B9060E B9060F"
print"B90610 B90611 B90612 B90613"
print"B90614 B90615 B90616 B90617"
print"B90618 B90619 B9061A B9061B"
print"B9061C B9061D B9061E B9061F"
print"B90700"
print"B90005"
print"B90400 B905FF"
print"B90600 B90601 B90602 B90603"
print"B90604 B90605 B90606 B90607"
print"B90608 B90609 B9060A B9060B"
print"B9060C B9060D B9060E B9060F"
print"B90610 B90611 B90612 B90613"
print"B90614 B90615 B90616 B90617"
print"B90618 B90619 B9061A B9061B"
print"B9061C B9061D B9061E B9061F"
print"B90700"
print"B90000 B902FF B9030F B9049F"
print"B90001 B902FF B9030F B9049F"
print"B90002 B902FF B9030F B9049F"
print"B90003 B902FF B9030F B9049F"
print"B90004 B902FF B9030F B9049F"
print"B90005 B902FF B9030F B9049F"
print"B90000 B90480"
print"B90001 B90480"
print"B90002 B90480"
print"B90003 B90480"
print"B90004 B90480"
print"B90005 B90480"

print"B981FF "
print"B98000"
print"B98400 B985FF"
print"B98600 B98601 B98602 B98603"
print"B98604 B98605 B98606 B98607"
print"B98608 B98609 B9860A B9860B"
print"B9860C B9860D B9860E B9860F"
print"B98610 B98611 B98612 B98613"
print"B98614 B98615 B98616 B98617"
print"B98618 B98619 B9861A B9861B"
print"B9861C B9861D B9861E B9861F"
print"B98800 B98900 "
print"B98001"
print"B98400 B985FF"
print"B98600 B98601 B98602 B98603"
print"B98604 B98605 B98606 B98607"
print"B98608 B98609 B9860A B9860B"
print"B9860C B9860D B9860E B9860F"
print"B98610 B98611 B98612 B98613"
print"B98614 B98615 B98616 B98617"
print"B98618 B98619 B9861A B9861B"
print"B9861C B9861D B9861E B9861F"
print"B98002"
print"B98400 B985FF"
print"B98600 B98601 B98602 B98603"
print"B98604 B98605 B98606 B98607"
print"B98608 B98609 B9860A B9860B"
print"B9860C B9860D B9860E B9860F"
print"B98610 B98611 B98612 B98613"
print"B98614 B98615 B98616 B98617"
print"B98618 B98619 B9861A B9861B"
print"B9861C B9861D B9861E B9861F"
print"B98003"
print"B98400 B985FF"
print"B98600 B98601 B98602 B98603"
print"B98604 B98605 B98606 B98607"
print"B98608 B98609 B9860A B9860B"
print"B9860C B9860D B9860E B9860F"
print"B98610 B98611 B98612 B98613"
print"B98614 B98615 B98616 B98617"
print"B98618 B98619 B9861A B9861B"
print"B9861C B9861D B9861E B9861F"
print"B98004"
print"B98400 B985FF"
print"B98600 B98601 B98602 B98603"
print"B98604 B98605 B98606 B98607"
print"B98608 B98609 B9860A B9860B"
print"B9860C B9860D B9860E B9860F"
print"B98610 B98611 B98612 B98613"
print"B98614 B98615 B98616 B98617"
print"B98618 B98619 B9861A B9861B"
print"B9861C B9861D B9861E B9861F"
print"B98700"
print"B98005"
print"B98400 B985FF"
print"B98600 B98601 B98602 B98603"
print"B98604 B98605 B98606 B98607"
print"B98608 B98609 B9860A B9860B"
print"B9860C B9860D B9860E B9860F"
print"B98610 B98611 B98612 B98613"
print"B98614 B98615 B98616 B98617"
print"B98618 B98619 B9861A B9861B"
print"B9861C B9861D B9861E B9861F"
print"B98700"
print"B98000 B982FF B9830F B9849F"
print"B98001 B982FF B9830F B9849F"
print"B98002 B982FF B9830F B9849F"
print"B98003 B982FF B9830F B9849F"
print"B98004 B982FF B9830F B9849F"
print"B98005 B982FF B9830F B9849F"
print"B98000 B98480"
print"B98001 B98480"
print"B98002 B98480"
print"B98003 B98480"
print"B98004 B98480"
print"B98005 B98480"

lct=0

open finp$ for input as #1
while eof(1)=0
  file input #1,txrd$
  setcaption("b:"+str$(lct)):lct+=1
  if mid$(txrd$,1,1)="[" then:
    if mid$(txrd$,2,1)="f" then:
      chid=val(mid$(txrd$,3,2))
      chid=chid mod 12 'huc6280 has 12 channels
      chfqv=vldc(lstinf$(txrd$,":","]"))
      chfqv2=int(26.6984611843*2^(8-chfqv))
      if chfqv2>2047 then:chfqv2=2047:end if
      if chfqv2<0 then:chfqv2=0:end if
      chchrfq$=right$("000"+hex$(chfqv2),3)
      if int(chid/6)=0 then
        txrgo$="B900"+right$("00"+hex$( (chid mod 6) ),2)
        txrgo$+=" B902"+mid$(chchrfq$,2,2)
        txrgo$+=" B9030"+mid$(chchrfq$,1,1)
      else
        txrgo$="B980"+right$("00"+hex$( (chid mod 6) ),2)
        txrgo$+=" B982"+mid$(chchrfq$,2,2)
        txrgo$+=" B9830"+mid$(chchrfq$,1,1)
        end if
      print ucase$(txrgo$)
      end if
    if mid$(txrd$,2,1)="v" then:
      chid=val(mid$(txrd$,3,2))
      chid=chid mod 12 'huc6280 has 12 channels
      chvlv=vldc(lstinf$(txrd$,":","]"))*0x10
      chchrvl$=right$("00"+hex$(chvlv),1)
      if int(chid/6)=0 then
        txrgo$="B900"+right$("00"+hex$( (chid mod 6) ),2)
        txrgo$+="B9048"+chchrvl$
      else
        txrgo$="B980"+right$("00"+hex$( (chid mod 6) ),2)
        txrgo$+="B9848"+chchrvl$
        end if
      print ucase$(txrgo$)
      end if
    if mid$(txrd$,2,3)="wvb" then:
      wvblv=vldc(lstinf$(txrd$,":","]"))
      wvblv2=wvblv*44100
      wvblv3a=wvblv2 mod 65536
      wvblv3b=int(wvblv2/65536)
      wvblv3as$=ucase$(right$("0000"+hex$(wvblv3a),4))
      for ii=1 to wvblv3b:print"61FFFF":next
      print "61"+mid$(wvblv3as$,3,2)+mid$(wvblv3as$,1,2)
      end if
    end if
  wend
print:print "66":print
close #1


